home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / hypercrd / xcmds / shwdlg16.hqx / ShowDialog XCMD 1.6 / card_6182.txt < prev    next >
Text File  |  1989-05-10  |  9KB  |  223 lines

  1. -- card: 6182 from stack: in.6
  2. -- bmap block id: 4269
  3. -- flags: 2000
  4. -- background id: 3411
  5. -- name: Type 4 XCMD
  6. ----- HyperTalk script -----
  7. on closeCard
  8.   lock screen
  9.   hide cd fld "theList"
  10.   hide cd pict
  11.   hide cd btn "OK"
  12.   unlock screen
  13.   pass closeCard
  14. end closeCard
  15.  
  16. on showButtons
  17.   show cd btn ID 2
  18. end showButtons
  19.  
  20. on turnOn
  21.   hide cd fld "theList"
  22.   hide cd pict
  23.   pass turnOn
  24. end turnOn
  25.  
  26.  
  27. -- part 2 (button)
  28. -- low flags: 80
  29. -- high flags: A003
  30. -- rect: left=225 top=148 right=170 bottom=474
  31. -- title width / last selected line: 0
  32. -- icon id / first selected line: 0 / 0
  33. -- text alignment: 1
  34. -- font id: 0
  35. -- text size: 12
  36. -- style flags: 0
  37. -- line height: 16
  38. -- part name: "Change" Dialog with Popup
  39. ----- HyperTalk script -----
  40. on mouseUp
  41.   put "<BBold,<IItalic,<OOutline,<UUnderline,<SShadow,(-," & "Everything,Letters Only,Numbers Only,Uppercase,Lowercase" into theMenu
  42.   ShowDialog 4,4745,"Find What:","Change To:", "Your string goes here.",theMenu,7
  43.   if the result is empty then
  44.     put return & "You clicked the ΓÇ£CancelΓÇ¥ button." into bg fld "theResult"
  45.   else
  46.     put the result into temp
  47.     put "Menu item selected was:" && item 1 of temp & return into bg fld "theResult"
  48.     if item 2 of temp is empty then
  49.       put "String 1 was:  empty" & return after bg fld "theResult"
  50.     else put "String 1 was:" && item 2 of temp & return after bg fld "theResult"
  51.     if item 3 of temp is empty then
  52.       put "String 2 was:  empty" after bg fld "theResult"
  53.     else put "String 2 was:" && item 3 of temp after bg fld "theResult"
  54.   end if
  55. end mouseUp
  56.  
  57.  
  58.  
  59. -- part 3 (button)
  60. -- low flags: 80
  61. -- high flags: A003
  62. -- rect: left=426 top=260 right=282 bottom=461
  63. -- title width / last selected line: 0
  64. -- icon id / first selected line: 0 / 0
  65. -- text alignment: 1
  66. -- font id: 0
  67. -- text size: 12
  68. -- style flags: 0
  69. -- line height: 16
  70. -- part name: OK
  71. ----- HyperTalk script -----
  72. on mouseUp
  73.   lock screen
  74.   hide me
  75.   hide cd pict
  76.   unlock screen with zoom in
  77. end mouseUp
  78.  
  79.  
  80.  
  81. -- part 4 (field)
  82. -- low flags: 81
  83. -- high flags: 2004
  84. -- rect: left=162 top=63 right=284 bottom=350
  85. -- title width / last selected line: 0
  86. -- icon id / first selected line: 0 / 0
  87. -- text alignment: 0
  88. -- font id: 4
  89. -- text size: 9
  90. -- style flags: 0
  91. -- line height: 12
  92. -- part name: theList
  93. ----- HyperTalk script -----
  94. on mouseUp
  95.   lock screen
  96.   hide me
  97.   unlock screen with zoom in
  98. end mouseUp
  99.  
  100.  
  101. -- part 6 (button)
  102. -- low flags: 00
  103. -- high flags: 0000
  104. -- rect: left=11 top=4 right=64 bottom=78
  105. -- title width / last selected line: 0
  106. -- icon id / first selected line: 529 / 529
  107. -- text alignment: 1
  108. -- font id: 0
  109. -- text size: 12
  110. -- style flags: 0
  111. -- line height: 16
  112. -- part name: SD
  113.  
  114.  
  115. -- part contents for background part 21
  116. ----- text -----
  117. ShowDialog XCMD Type 4
  118.  
  119. -- part contents for background part 30
  120. ----- text -----
  121. 16
  122.  
  123. -- part contents for background part 18
  124. ----- text -----
  125. ShowDialog XCMD Type 4  displays an "ask" or 
  126. "answer" dialog that contains a popup menu and as many Editable Text fields as you desire.  
  127.  
  128. The items in the popup menu are constructed on the fly by passing to ShowDialog a variable containing the items that you would like to appear in the menu, separated by commas.  You can modify the style attributes of the individual menu items, enable and disable them, and even attach icons to them, all on the fly.
  129.  
  130. You also tell ShowDialog which one of the menu items is to be checked when the dialog is initially displayed.  When the OK button is clicked, "the result" will contain the item number from the menu that was currently selected, along with the text of your Editable Text fields in a return-delimited list.
  131.  
  132. HyperCard runs on System 3.2 and above, but popup menus were not implemented in the Toolbox until System 4.0.  ShowDialog first checks your system configuration and then exits gracefully 
  133. (with a beep) if you are running an early system, thus saving you from a fiery crash.
  134.  
  135.            •••••••••••••••••
  136. If you've been using versions of ShowDialog older than 1.6, please note that the result for Type 4 is now RETURN-delimited, instead of comma-delimited.  ShowDialog Type 4 can also now have as many Editable Text fields as you desire.
  137.            •••••••••••••••••
  138.  
  139.  
  140.  
  141. -- part contents for background part 17
  142. ----- text -----
  143. Menu items can be disabled (grayed out) by preceding the item with a left parenthesis, like this: (theItem.  To insert a menu break, put (- as an item in your menu list.  The Toolbox will automatically extend the hyphen the length of the menu; the "(" will cause it to be disabled, so that the menu break cannot be selected.
  144.  
  145. To control the character style of the individual menu items, prefix the item with the modifier character "<" and a letter standing for the desired attribute.
  146.  
  147.                         <BtheItem  for bold
  148.                         <ItheItem   for italic
  149.                         <OtheItem  for outline
  150.                         <UtheItem  for underline
  151.                         <StheItem  for shadow
  152.  
  153. To include an icon to the left of a menu item, prefix the text of the item with a circumflex (^) followed by an ASCII character.  The ordinal value of this character plus 208 yields the resource ID of the ICON to display.  ΓÇó Click┬áhere┬áfor┬álist. ΓÇó
  154.  
  155. Constructing DLOG/DITL templates for Type 4 of ShowDialog XCMD is only slightly more involved than for the others.
  156.  
  157. Constructing the popup menu:
  158. The popup menu consists of two DITL items, which MUST be items 5 and 6.
  159. They are: 
  160. DITL item #5: an ENABLED useritem.  This will be your popup "hot spot."
  161. DITL item #6: DISABLED static text.  This will be your popup menu title.  You cannot modify the popup menu title on the fly.  Enter in the text string in the DITL template.
  162.  
  163. These two items can be as LONG as you want, but both MUST be 17 pixels high.  This is so that the popup will be positioned correctly on top of the hot spot and the title will hilite correctly.
  164.  
  165. The popup menu title (DITL item #6) MUST be positioned TO THE LEFT of the hot spot (item #5). They should touch each other by ONE pixel (this is for cosmetic reasons only).  ΓÇó Click┬áhere┬áto┬ásee. ΓÇó
  166.  
  167. Follow this outline when constructing the DITL resource:
  168. item #1:  OK button (the default)
  169. item #2:  Cancel button
  170. item #3:  Editable Text field, if you want one* (to contain default entry string)
  171. item #4:  Editable Text field (if you want one)*
  172. item #5:  Popup menu hot spot (ENABLED useritem);
  173. item #6:  Popup menu title (DISABLED static text);
  174. remaining items:  Static Text fields, icons, and PICT's
  175.  
  176. * if you don't want any fields of Editable Text, it's okay to have items 3 and 4 be icons, static text, PICTs, etc.
  177.  
  178. The ONLY items that are to be ENABLED are buttons, your popup hot spot, and Editable Text fields.
  179.  
  180. Your dialog will be displayed with the popup menu item selected that you specified in the parameter list.  When you click on the hot spot the popup menu title will invert and the popup menu will appear over the hot spot.
  181.  
  182. The result consists of a return-delimited list.  The popup menu item number currently selected when the OK button is clicked will be returned as line 1 of "the result."  The text in the Editable Text fields will be returned as the remaining lines of "the result."
  183.  
  184. If the user clicks CANCEL "the result" will be empty.
  185.  
  186.  
  187.  
  188. -- part contents for background part 15
  189. ----- text -----
  190. ShowDialog Type 4 parameters are:
  191.  
  192. ShowDialog 4,<DLOG resource ID>,<first prompt string>,<second prompt string>,<default entry string>,<popup menu variable>,<menu item checked>,[<top coord>,<left coord>]
  193.  
  194. where 4 is the type of the external;
  195. <DLOG resource ID> is the resource ID of the DLOG template;
  196. <first prompt string> consists of the dialog's first text string;
  197. <second prompt string> consists of the dialog's second text string (if you want one);
  198. <default entry string> is a default text string to appear in a text entry field;
  199. <popup menu variable> is a variable containing the items, separated by commas, that are to appear in the popup menu;
  200. <menu item checked> is the item NUMBER from your item list that will be initially checked on the popup menu and displayed in the dialog.
  201.  
  202. Once again, the last two parameters, for specifying the location of the dialog, are OPTIONAL.
  203.  
  204.  
  205.  
  206. -- part contents for card part 4
  207. ----- text -----
  208. The table below lists some of the ASCII Character,ICON number combinations.
  209.  
  210. ^A = 273  ^N = 286  ^1 = 257
  211. ^B = 274  ^0 = 287  ^2 = 258
  212. ^C = 275  ^P = 288  ^3 = 259
  213. ^D = 276  ^Q = 289  ^4 = 260
  214. ^E = 277  ^R = 288  ^5 = 261
  215. ^F = 278  ^S = 290  ^6 = 262
  216. ^G = 279  ^T = 291  ^7 = 263
  217. ^H = 280  ^U = 292  ^8 = 264
  218. ^I = 281  ^V = 293  ^9 = 265
  219. ^J = 282  ^W = 294   
  220. ^K = 283  ^X = 295    
  221. ^L = 284  ^Y = 296    
  222. ^M = 285  ^Z = 297   
  223.